//
//  NSView+NSViewController.swift
//  OneMeeting
//
//  Created by zhangheng on 2019/8/15.
//  Copyright © 2019 www.zhangheng.com. All rights reserved.
//

import Foundation
import Cocoa

extension NSView {
    
    func jk_viewcontroller() -> NSViewController? {
        var next = self.nextResponder
        while (next != nil) {
            if (next?.isKind(of: NSViewController.classForCoder())) == true {
                return next as? NSViewController
            }
            next = next?.nextResponder
        }
        return nil
    }
}
